package com.witmore.skyline.web.controller;

import com.witmore.skyline.web.controller.vo.param.DeviceParamVO;
import com.witmore.skyline.web.controller.vo.param.DeviceWorkTimeListParamVO;
import com.witmore.skyline.web.controller.vo.result.ResponseResult;
import com.witmore.skyline.web.service.DeviceTimeService;
import com.witmore.skyline.web.service.third.yjx.dto.WorkDetailDTO;
import com.witmore.skyline.web.service.third.yjx.dto.WorkTimeListDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.validation.Valid;
import java.util.List;

/**
 * 设备工时接口
 * Author: 豆子高
 * Date: 2025/2/27 14:26
 */
@RestController
@RequestMapping("api/device/")
public class DeviceTimeController {
    @Autowired
    private DeviceTimeService deviceTimeService;

    /**
     * 工时统计
     */
    @GetMapping(value = "detail/workTimeList",name = "工时统计")
    public ResponseResult<List<WorkTimeListDTO>> workTimeList(@Valid DeviceWorkTimeListParamVO deviceWorkTimeListParamVO) {
        return deviceTimeService.workTimeList(deviceWorkTimeListParamVO.getDeviceSn(), deviceWorkTimeListParamVO.getStartDay(), deviceWorkTimeListParamVO.getEndDay());
    }

    /**
     * 开关机详情
     */
    @GetMapping(value = "detail/powerOnOffDetails",name = "开关机详情")
    public ResponseResult<List<WorkDetailDTO>> powerOnOffDetails(@Valid DeviceParamVO deviceParamVO) {
        return deviceTimeService.workTimeDetails(deviceParamVO.getDeviceSn(), deviceParamVO.getDate());
    }

    /**
     * 某天工作详情带状态
     */
    @GetMapping(value = "detail/workTimeDetailsWithStatus",name = "某天工作详情带状态")
    public ResponseResult<List<WorkDetailDTO>> workTimeDetailsWithStatus(@Valid DeviceParamVO deviceParamVO) {
        return deviceTimeService.workTimeDetailWithStatus(deviceParamVO.getDeviceSn(), deviceParamVO.getDate());
    }

}
